﻿using System.Linq.Expressions;

namespace Hu.Core.Domains.Basic.Interface
{
    public interface IRepository<TEntity> where TEntity : class
    {
        /// <summary>
        /// 查询所有数据
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<TEntity>> SqlQuery(FormattableString str);
        Task<TEntity> GetByIdAsync(int id);
        Task<IEnumerable<TEntity>> QueryAsync(Expression<Func<TEntity, bool>> predicate);
        Task AddAsync(TEntity entity);
        void UpdateAsync(TEntity entity);
        Task DeleteAsync(int id);

        Task<int> SaveChangesAsync();
    }
}
